package acessoDados.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import acessoDados.dao.NotificacaoDAO;

public class NotificacaoDAOImpl extends BaseDAOImpl implements NotificacaoDAO {

	public  void criaNotificacao(String descricao, int idReserva) throws SQLException, ClassNotFoundException {
		String query = "INSERT INTO notificacao (descricao, idReserva)" + "VALUES ('" + descricao + "', " + idReserva + ");";
		executaQueryUpdate(query);
	}

	public  ResultSet getNotificacoes(String id) throws SQLException, ClassNotFoundException {
 		String query = "SELECT n.idNotificacao, n.idReserva, n.descricao FROM notificacao n, reserva r "+
 				"WHERE n.idReserva=r.idReserva AND r.login='"+id+"';";
 		return executaQuery(query);
	}
}
